#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
char *procname = "c.c";
#define MAX_MSGSIZE 128
/* for error feed back from lbdaemon */
#define PORT 6543
int sock_fd;
struct sockaddr_in my_addr;
struct reterr {
	int err;
};
char buf[MAX_MSGSIZE];
/************************************/
void init_sock(void)
{
	int ret;

	if ( (sock_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
	{
		syslog(LOG_USER|LOG_INFO, "%s: socket initial failure\n", procname);
		exit(EBUSY);
	}
	my_addr.sin_family = AF_INET;
	my_addr.sin_port   = htons(PORT);
	my_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
}

int main()
{
	int ret;
	int fd;
	struct sockaddr_in addr;
	socklen_t len;
	len = sizeof(struct sockaddr);
	init_sock();
	ret = connect(sock_fd, (struct sockaddr*)&my_addr, len);
	if (ret < 0)
		perror("connect failure");
	send(sock_fd, "send buf hello", 14, 0);
	close(sock_fd);
	return 0;
}
